﻿using System;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using mojoPortal.Web.RS.AppCode.Lib;

namespace mojoPortal.Web.RS
{
    public class RSBaseUserControl : System.Web.UI.UserControl
    {
        public RSBaseUserControl()
        {
            
        }

        public RSUserIdentity GetRSUserIdentity()
        {
            RSUserIdentity userIdentity = null;
            if (Session["USER_IDENTITY"] != null)
            {
                userIdentity = (RSUserIdentity)Session["USER_IDENTITY"];
            }
            else
            {
                userIdentity = new RSUserIdentity();
                Session["USER_IDENTITY"] = userIdentity;
            }
            
            return userIdentity;
        }

        public string GetRSCompanyConnectionString()
        {
            string rsConnectionString = string.Empty;
            if (Session["COMPANY_CONNECTIONSTRING"] != null)
            {
                rsConnectionString = Session["COMPANY_CONNECTIONSTRING"].ToString();
            }
            else
            {
                rsConnectionString = RSCommonFunctions.GetRSCompanyConnectionString();
                Session["COMPANY_CONNECTIONSTRING"] = rsConnectionString;
            }
            return rsConnectionString;
        }

    }

}